limsExportTemplate.choosePage = {

    getGridParam: function () {
        var _this = this, columns = limsExportTemplate.getChooseListColumns()
        _this.param.single ? columns.unshift({
            radio: true
        }) : columns.unshift({
            checkbox: true
        })
        return {
            type: 'grid',
            id: 'lims-export-template-choose-list-grid',
            url: limsExportTemplate.baseUrl + '/queries',
            service: 'limsExportTemplateServiceImpl',
            dbTable: 'T_LIMS_EXPORT_TEMPLATE',
            columns: columns,
            requestData : _this.param,
            onCellClick: function (field, row) {
            },
            onLoadSuccess: function (data) {
                if (!Gikam.isEmpty(data)) {
                    this.activeRowByIndex(0)
                } else {
                }
            },
            onRowActive: function (index, row) {
            },
            toolbar: [{
                type: 'button',
                text: 'GIKAM.BUTTON.CONFIRM',
                icon: 'select',
                onClick: function () {
                    let selections = Gikam.getComp('lims-export-template-choose-list-grid').getSelections()
                    if (Gikam.isEmpty(selections)) {
                        Gikam.alert('GIKAM.TIP.CHOOSE_AT_LEAST_ONE_ITEM')
                        return
                    }
                    Gikam.getLastModal().close(selections)
                }
            }]
        }
    },

    create: function () {
        var _this = this
        Gikam.create('layout', {
            id: 'lims-export-template-choose-list-layout',
            renderTo: Gikam.getLastModal().window.$dom,
            center: {
                items: [this.getGridParam()]
            }
        })
    },

    init: function (param) {
        this.param = param
        this.create()
    }
}
